<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body><?php
include_once '../Login/databaseconnection.php';

if(!loggedin())
{
	require_once '../index.php';
}
   
   else
	  
   {
  $P_Id=$_SESSION['P_Id'];
	    $S_Id=$_SESSION['S_Id'];
	    $year=$_SESSION['year'];
		
		$P_Id1=$_POST['Pro_Id'];
	   $S_Id1=$_POST['Sch_Id'];
	   $year1=$_POST['Year'];
    $Pro_name=$_POST['Programme_Name'];
    $No_Stu=$_POST['No_Of_Students'];
   $No_Tra_tea=$_POST['Teachers_In_Training'];
    $Tra_tea=$_POST['Trained_Teachers'];
    $Avai_Book=$_POST['Avai_Book'];
 $Avai_Tea_Gui=$_POST['Avai_Tea_Gui'];
   
   if($P_Id==null)
   {
	   echo "null";
   }
   if($Pro_name==""||$No_Stu==""||$No_Tra_tea==""||$Tra_tea=="")
	{
		   $_SESSION['errorin']="Please check your inputs!";
	 
	}
	else
	{
	
$sql=mysql_query("UPDATE programmes SET Programme_Id='$P_Id1',Year='$year1',School_Id='$S_Id1',Programme_Name='$Pro_name',No_Of_Students='$No_Stu',Teachers_In_Training='$No_Tra_tea',Trained_Teachers='$Tra_tea',Availability_Books='$Avai_Book',Availability_Tguides='$Avai_Tea_Gui' WHERE Programme_Id='$P_Id' AND Year='$year' AND School_Id='$S_Id'");

unset($_SESSION['P_Id']);
unset($_SESSION['S_Id']);
unset($_SESSION['year']);
if($sql)
  {
$_SESSION['error']="This record is successfully updated!";

  }

  if(!$sql)
  {
 $_SESSION['error']="Sorry unable to update this record!";


  }
	
}
}
  ?>
</body>
</html>
